package org.elucid.chess;

import org.apache.log4j.Logger;

/**
 * 
 * 
 * @author george
 * 
 */
public class BasicGame extends AbstractGame {

	private static Logger log = Logger.getLogger(BasicGame.class);

	public enum PlayerConfig {
		HumanVsHuman, CpuVsCpu, CpuVsHuman, HumanVsCpu
	}

	/**
	 * 
	 * @param board
	 * @param whitePlayer
	 * @param blackPlayer
	 */
	public BasicGame(PlayerConfig playerConfig) {
		super();

		switch (playerConfig) {
		case CpuVsCpu: {
			this.whitePlayer = new CpuPlayer(true, this);
			this.blackPlayer = new CpuPlayer(false, this);
		}
			;
			break;
		case CpuVsHuman: {
			this.whitePlayer = new CpuPlayer(true, this);
			this.blackPlayer = new HumanPlayer(false, this);
		}
			;
			break;
		case HumanVsCpu: {
			this.whitePlayer = new HumanPlayer(true, this);
			this.blackPlayer = new CpuPlayer(false, this);
		}
			;
			break;	
		case HumanVsHuman: {
			this.whitePlayer = new HumanPlayer(true, this);
			this.blackPlayer = new HumanPlayer(false, this);
		}
			;
			break;			
		}

		this.currentPlayer = whitePlayer;
		calculateThreats();

		log.info("created Game");
	}

	@Override
	public void setGameOver(boolean b) {
		this.gameOver = true;
	}

}
